package com.key.common.vo;

import com.key.entity.Apply;
import com.key.utils.OddNumbersUtils;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author wen
 * @create 2023-02-22 20:57
 */
@ApiModel("用户侧申请表视图")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ApplyVO {
    private String applyNumber;//单据号
    private long assetNum;//单号包含资产数
    private String approver;//管理员
    private String applyDate;//申请日期
    private String approveDate;//批准日期
    private String stats;//状态
    private String applyType;//资产领用,资产借用,资产退库，资产归还
    private String signDate;//签收日期

    public ApplyVO(Apply apply){

        applyNumber=apply.getApplyNumber();
        assetNum=apply.getAssetNum();
        approver=apply.getApprover();
        applyDate= OddNumbersUtils.toDay(apply.getApplyDate());
        if(apply.getApproveDate()!=null){
            approveDate =OddNumbersUtils.toDay(apply.getApproveDate());
        }
        stats=apply.getStats();
        applyType=apply.getApplyType();
        if(apply.getSignDate()!=null){
            signDate=OddNumbersUtils.toDay(apply.getSignDate());
        }
    }
}
